package com.atshiyou.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class RestFulController {
    @RequestMapping(value = "/testRestful/{uname}/{uage}",method = RequestMethod.DELETE)
    public String restful_D(@PathVariable("uname") String name,@PathVariable("uage") int age){

        System.out.println("delete请求"+"name:"+name+",age:"+age);
        return "deletesuccess";
    }
    @RequestMapping(value = "/testRestful/{uname}/{uage}",method = RequestMethod.PUT)
    public String restful_PUT(@PathVariable("uname") String name,@PathVariable("uage") int age){
        System.out.println("put请求"+"name:"+name+",age:"+age);
        return "putsuccess";
    }
    @RequestMapping(value = "testRestful/{uname}/{uage}",method = RequestMethod.GET)
    @ResponseBody
    public String restful_G(@PathVariable("uname") String name,@PathVariable("uage") int age){
        System.out.println("get请求"+"name:"+name+",age:"+age);
        return "getsuccess";
    }
    @RequestMapping(value = "testRestful/{uname}/{uage}",method = RequestMethod.POST)
    @ResponseBody
    public String restful_POST(@PathVariable("uname") String name,@PathVariable("uage") int age){
        System.out.println("post请求"+"name:"+name+",age:"+age);
        return "postsuccess";
    }

}
